Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

399
Visualizações
Why is float.IsFinite “not defined” in Unity?

When I use float.IsFinite(float f) in a C# shell, I have no problems. However, when I use it in the context of Unity, I get an error alleging that it is not defined:

error CS0117: 'float' does not contain a definition for 'IsFinite'

Here is the relevent code:

public static bool IsFinite(Unit u) => float.IsFinite(u.blocks);

Unit is a struct in which I wrote the above line.

My question is: why does this error appear and how can I fix it?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

float.IsFinite exists in .NET 5, .NET Standard 2.1 and .NET Core 2.1. However Unity supports neither of those frameworks, just .NET Standard 2.0. This is why you cannot use the function here.

However it´s easy to create a workaround for the lack of that function:

public static bool IsFinite(Unit u) => !float.IsInfinity(u.blocks)

There´s an angoing discussion at Unitity support forum about .NET 5

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda